//
//  HomeSearchFrame.m
//  ReceiptDelivery
//
//  Created by 吕晶 on 2020/11/17.
//  Copyright © 2020 吕晶. All rights reserved.
//

#import "HomeSearchFrame.h"

@implementation HomeSearchFrame

-(void)setWordModel:(HomeSearchModel *)wordModel {
    _wordModel = wordModel;
    
    CGSize wordSize = [FactoryMethod sizeWithText:wordModel.wordText font:[UIFont systemFontOfSize:12] maxSize:CGSizeMake(0, 0)];
    CGFloat bgW = wordSize.width + 10 + 10 + 18 + 10 > ScreenW - 30 ? ScreenW - 40 : wordSize.width + 10 + 10 + 18 + 10;
    CGFloat bgH = wordSize.height + 12;
    CGFloat bgX = 0;
    CGFloat bgY = 0;
    _bgF = CGRectMake(bgX, bgY, bgW, bgH);
    
    _size = CGSizeMake(bgW, bgH);
    
    _deleteF = CGRectMake(_bgF.size.width - 10 - 18, (bgH - 18) * 0.5, 18, 18);
    _wordF = CGRectMake(10, 6, _bgF.size.width - 10 - 18 - 10 - 10, wordSize.height);
}

@end
